Xi-Language Reference: Interpolation
- resize (Resizes an array)
- spline (Computes a spline under tension)
- spline2d (Grid a set of data points in the two dimensional plane)
- spline_curve (Determines a parametric spline under tension)
Parameters
resize ( array, dim..., sample = 0, linear = 0 )
Types: array Any[]
dim... int
sample int
linear int
Return
Any[] (matches \e\array\e\)
Description
This functions resizes a multidimensional array. The new dimensions are given
by the parameters dim1, dim2, ... . If the flag sample i
set resize uses nearst neigbbourhood sampling to magnify or shrink the
array. Set linear to advice resize to use the
multilinear interpolation method. If either sample or linear
are given resize uses nearst neigbbourhood sampling.
Example
>a=dincarr(5);
>b=resize(a,10,\linear);
>c=resize(a,10,\sample);
>print(a,b,c);
<dblarr>
0 1 2 3 4
<dblarr>
0.2 0.6 1 1.4 1.8
2.2 2.6 3 3.4 3.8
<dblarr>
0 0 1 1 2
2 3 3 4 4
Parameters
spline ( x, y, value, tension = 0.0 , period = 0.0 )
Types: x double[]
y double[]
value double[]
tension double
period double
Return
double[] (spline at desired coordinates)
Description
spline computes a spline under tension interpolation of the
data points given by the vectors x and y. The desired abscissa
values are determined by the vector value. If tension is nearly
zero the interpolation will be approximately a cubic spline. For increasing
tension the result comes closer to a polygonal line. By default the function
estimates internally the slopes at the two ends of the curve. If
period is set spline computes a periodic interpolatory
spline with this period.
Example
( 1)>x=dincarr(10)/3;
( 2)>y={2,4,3,2,5,4,7,5,4,7};
( 3)>value=dincarr(100)/30.;
( 4)>yn=spline(x,y,value);
( 5)>plot(value,yn,\marker=3);
See also
spline_curve,
spline2d
Parameters
spline2d ( x, y, z, xn, yn, nppr = 10 )
Types: x double[]
y double[]
z double[]
xn double[]
yn double[]
nppr int
Return
double[] (3d surface at the desired points)
Description
spline2d grids a set of data points in a two dimensional plane
(scattered data interpolation problem). x, y and z contain
the x,y and z coordinates of the data points.
xn and yn specify the x and y coordinates
at which the interpolation function is to be calculated.
The parameter nppr determines the desired average number of
points per region. The infuence region of a point has a area which is
roughly proportional to nppr
See also
spline,
spline_curve
Reference
This function is based on the subroutine LOTPSof the module LOTPS
from package CMLIB.
C SUBROUTINE LOTPS
C THIS VERSION IS DATED 03/04/82.
C
C RICHARD FRANKE
C DEPARTMENT OF MATHEMATICS
C NAVAL POSTGRADUATE SCHOOL
C MONTEREY, CALIFORNIA 93940
C (408)646-2758 / 2206
Parameters
spline_curve ( x, y, value, tension = 0.0 , closed = 0 )
Types: x double[]
y double[]
value double[]
tension double
closed int
Return
[double[],double[]] (x and y coordinates of the spline)
Description
The function spline_curve computes a spline under tension
passing through a sequence of points (x[0], y[0]), ... , (x[n-1], y[n-1])
(n is the number of entries of x or y).
value contains the values to be mapped to the points on the curve
The interval (0,1) for value is mapped onto the curve. This means 0 is
mapping to (x[0], y[0]) and 1 mapping to (x[n-1], y[n-1]).
If tension is nearly zero the interpolation will be approximately a
cubic spline. For increasing tension the result comes closer to a
polygonal line. By default the function estimates internally the
slopes at the two ends of the curve. If closed is set
spline_curve computes a closed curve in the plane.
Example
( 1)>i=interval(0,6.28,5);
Function interval defined
( 2)>x=cos(i);
( 3)>y=sin(i);
( 4)>[xn1, yn1]=spline_curve(x,y,dincarr(100)/100.);
( 5)>[xn2, yn2]=spline_curve(x,y,dincarr(100)/100.,\closed);
( 6)>plot(xn1,yn1,\line);
( 7)>plot(xn2,yn2,\line);
See also
spline,
spline2d
© 1995 by Bodo Junglas, Klaus Spanderen and Fabian Weis
- Last revised: Wed Jun 19 16:58:32 1996